home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.4)
-
- '''Python version compatibility support for minidom.'''
- __all__ = [
- 'NodeList',
- 'EmptyNodeList',
- 'NewStyle',
- 'StringTypes',
- 'defproperty',
- 'GetattrMagic']
- import xml.dom as xml
-
- try:
- unicode
- except NameError:
- StringTypes = (type(''),)
-
- StringTypes = (type(''), type(unicode('')))
-
- try:
- True
- except NameError:
- True = 1
- False = 0
- __all__.extend([
- 'True',
- 'False'])
-
-
- try:
- isinstance('', StringTypes)
- except TypeError:
- _isinstance = isinstance
-
- def isinstance(obj, type_or_seq):
-
- try:
- return _isinstance(obj, type_or_seq)
- except TypeError:
- for t in type_or_seq:
- if _isinstance(obj, t):
- return 1
- continue
-
- return 0
-
-
- __all__.append('isinstance')
-
- if list is type([]):
-
- class NodeList(list):
- __slots__ = ()
-
- def item(self, index):
- if index <= index:
- pass
- elif index < len(self):
- return self[index]
-
-
-
- def _get_length(self):
- return len(self)
-
-
- def _set_length(self, value):
- raise xml.dom.NoModificationAllowedErr("attempt to modify read-only attribute 'length'")
-
- length = property(_get_length, _set_length, doc = 'The number of nodes in the NodeList.')
-
- def __getstate__(self):
- return list(self)
-
-
- def __setstate__(self, state):
- self[:] = state
-
-
-
- class EmptyNodeList(tuple):
- __slots__ = ()
-
- def __add__(self, other):
- NL = NodeList()
- NL.extend(other)
- return NL
-
-
- def __radd__(self, other):
- NL = NodeList()
- NL.extend(other)
- return NL
-
-
- def item(self, index):
- pass
-
-
- def _get_length(self):
- return 0
-
-
- def _set_length(self, value):
- raise xml.dom.NoModificationAllowedErr("attempt to modify read-only attribute 'length'")
-
- length = property(_get_length, _set_length, doc = 'The number of nodes in the NodeList.')
-
- else:
-
- def NodeList():
- return []
-
-
- def EmptyNodeList():
- return []
-
-
- try:
- property
- except NameError:
-
- def defproperty(klass, name, doc):
- pass
-
-
- class GetattrMagic:
-
- def __getattr__(self, key):
- if key.startswith('_'):
- raise AttributeError, key
-
-
- try:
- get = getattr(self, '_get_' + key)
- except AttributeError:
- raise AttributeError, key
-
- return get()
-
-
-
- class NewStyle:
- pass
-
-
-
- def defproperty(klass, name, doc):
- get = getattr(klass, '_get_' + name).im_func
-
- def set(self, value, name = name):
- raise xml.dom.NoModificationAllowedErr('attempt to modify read-only attribute ' + repr(name))
-
- if not not hasattr(klass, '_set_' + name):
- raise AssertionError, 'expected not to find _set_' + name
- prop = property(get, set, doc = doc)
- setattr(klass, name, prop)
-
-
- class GetattrMagic:
- pass
-
- NewStyle = object
-